<div class="pageHeader">
	<form  method="post" action="" onsubmit="return dwzSearch(this, 'dialog');">
	<div class="searchBar">
		<ul class="searchContent">
			<select class="combox" name="name1" id="w_combox_city2" ref="w_combox_city2" onchange="Search_name2()">
            <option value="all">根分类</option>
           <?php foreach($data as $item):?>
                  <option value="<?php echo $item->tid;?>"><?php echo $item->name;?></option>
            <?php endforeach;;?>
            </select>
           <select  name="name2" id="w_combox_city" ref="w_combox_city" onchange="Search_name3()" >
           </select>
           <select  name="name3" id="w_combox_area" ref="w_combox_area" onchange="Search_video()">
           </select>

		</ul>
		<div class="subBar">
			<ul>
				<li><div class="buttonActive"><div class="buttonContent"><button type="submit">查询</button></div></div></li>
			</ul>
		</div>
	</div>
	</form>
</div>
<div class="pageContent">

	<table class="table" layoutH="118" targetType="dialog" width="100%">
		<thead>
			<tr>
				<th orderfield="orgName">名称</th>
				<th width="80">查找带回</th>
			</tr>
		</thead>
		<tbody id="video_list_table_data">
		</tbody>
	</table>
</div>
<script type="text/javascript">
function Search_name2()
{
	$("#w_combox_city").empty();
	var name2 = $("#w_combox_city2").val();
	var urls = "<?php echo site_url('admin/video/add_video_list');?>/"+name2;
	$.ajax({
			type:'POST', 
			dataType:"json", 
			url:urls, 
			cache: false,
			data:{},
			success: function(json){
			if (!json) return;
			var html = '';
			$.each(json, function(i){
				if (json[i] && json[i].length > 1){
						$("#w_combox_city").append('<option value="'+json[i][0]+'">' + json[i][1] + '</option>');
				}
				
			});
				
			},
			error: DWZ.ajaxError
			});
}
function Search_name3()
{
	$("#w_combox_area").empty();
	var name2 = $("#w_combox_city").val();
	var urls = "<?php echo site_url('admin/video/add_video_list');?>/"+name2;
	var htmls;
	$.ajax({
			type:'POST', 
			dataType:"json", 
			url:urls, 
			cache: false,
			data:{},
			success: function(json){
			if (!json) return;
			var html = '';
	
			$.each(json, function(i){
				if (json[i] && json[i].length > 1){
						$("#w_combox_area").append('<option value="'+json[i][0]+'">' + json[i][1] + '</option>');
						htmls += table_html(json[i][0],'分类:'+json[i][1]);
				}
				
			});
			$("#video_list_table_data").html(htmls);
			},
			error: DWZ.ajaxError
			});
}

function Search_video()
{
	//$("#w_combox_area").empty();
	var name2 = $("#w_combox_area").val();
	var urls = "<?php echo site_url('admin/video/Search_video');?>/"+name2;
	var htmls;
	$.ajax({
			type:'POST', 
			dataType:"json", 
			url:urls, 
			cache: false,
			data:{},
			success: function(json){
			if (!json) return;
			var html = '';
	
			$.each(json, function(i){
				if (json[i] && json[i].length > 1){
						htmls += table_html(json[i][0],'视频:'+json[i][1]);
				}
				
			});
			$("#video_list_table_data").html(htmls);
			},
			error: DWZ.ajaxError
			});
			
			
}

function table_html(id,names)
{
	var htmls = '';
	if(names != '分类:根分类' && names != '视频:根分类')
	{
		htmls = '<tr><td>'+names+'</td><td width="80"><a class="btnSelect" href="javascript:$.bringBack({id:\''+id+'\', orgName:\''+names+'\', orgNum:\'100'+id+'\'})" title="查找带回">选择</a></td></tr>';
	}

	return htmls;
}
</script>